package com.link.base.base.appduty.controller;


import com.link.base.base.appduty.model.AppMenuSecInter;
import com.link.base.base.appduty.model.AppQuickSetVO;
import com.link.base.base.appduty.service.AppMenuSecInterService;
import com.link.core.basic.annotations.JsonParam;
import com.link.core.basic.controller.BasicController;
import com.link.core.basic.service.BasicService;
import com.link.core.cllog.LCLogger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * Copyright  hande Company. All Rights Reserved.
 *
 * @author  unknwon
 * @date:   2018/11/8 13:47
 * @version 1.0
 */

@Controller
@RequestMapping("/link/appMenuSecInter")
public class AppMenuSecInterController extends BasicController<AppMenuSecInter> {

    @Resource
    private AppMenuSecInterService appMenuSecInterService;

    @Override
    public BasicService<AppMenuSecInter> getBasicService() throws Exception {
        return appMenuSecInterService;
    }

    /**
     * 快速设置安全性菜单
     *
     * @author 李莹
     * @date 2020/07/18 03:18
     */
    @PostMapping(value = "/quickSetupSecMenu", name = "快速设置安全性菜单")
    @ResponseBody
    public Map<String, Object> quickSetupSecMenu(@JsonParam AppQuickSetVO entity) throws Exception {
        Map<String, Object> result = new HashMap<>(8);
        try {
            appMenuSecInterService.quickSetupSecMenu(entity);
            result.put("success", true);
        } catch (Exception e) {
            LCLogger.withException(e);
            result.put("success", false);
            result.put("message", e.getMessage());
        }
        return result;
    }
}
